<template>
    <div>
        <ul>
            <li v-for="(item,index) in arr" :key="index">{{item}}<button @click="del(index)">删除</button></li>
        </ul>
        <button @click="add">生成</button>
    </div>
</template>

<script>
    export default {
        components: {},
        props: {},
        data() {
            return {
                arr: [1, 5, 3]
            };
        },
        computed: {},
        watch: {},
        created() { },
        methods: {
            add() {
                this.arr.push(Math.floor(Math.random() * (100)) + 1);
            },
            del(id) {
                this.arr.splice(id, 1);
            }
        }
    };
</script>

<style scoped>

</style>